package com.zrm.zfcrpa.vo;

import java.io.Serializable;



public class ResultResponse<T> implements Serializable {
	private static final long serialVersionUID = -5112602226070207006L;

	private String code;
	private String message;
	private T data;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
	
	public static <K> ResultResponse<K> success(K data){
		ResultResponse<K> res = new ResultResponse<K>();
		res.setCode("10000");
		res.setMessage("sucess");
		res.setData(data);
		return res;
	}
	
	public static <K> ResultResponse<K> error(String msg,K data){
		ResultResponse<K> res = new ResultResponse<K>();
		res.setCode("10001");
		res.setMessage(msg);
		res.setData(data);
		return res;
	}

	@Override
	public String toString() {
		return "ResultResponse [code=" + code + ", message=" + message + ", data=" + data + "]";
	}

}
